package com.csbc.arithmetic.fruit;

import java.math.BigDecimal;
import java.util.Objects;

public abstract class Fruit {

    Integer price;

    boolean isPromotion;

    Double discount;

    BigDecimal promotionPrice;

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public boolean isPromotion() {
        return isPromotion;
    }

    public void setPromotion(boolean promotion) {
        isPromotion = promotion;
    }

    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public BigDecimal getPromotionPrice() {
        return promotionPrice;
    }

    public void setPromotionPrice(BigDecimal promotionPrice) {
        this.promotionPrice = promotionPrice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}
        if (o == null || getClass() != o.getClass()) {return false;}
        Fruit fruit = (Fruit) o;
        return isPromotion == fruit.isPromotion &&
                Objects.equals(price, fruit.price) &&
                Objects.equals(discount, fruit.discount) &&
                Objects.equals(promotionPrice, fruit.promotionPrice);
    }

    @Override
    public int hashCode() {
        return Objects.hash(price, isPromotion, discount, promotionPrice);
    }
}
